package com.notemanagement.adapter;

import android.content.Context;
import android.content.IntentFilter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.notemanagement.R;
import com.notemanagement.bean.OrderDetailInfo;

import java.util.List;

/**
 * Created by 金 on 2015/1/17.
 */
public class OrderAdapter extends BaseAdapter {
    private List<OrderDetailInfo> infos;
    private Context mcontext;

    public OrderAdapter(List<OrderDetailInfo> infos, Context context){
        this.infos = infos;
        this.mcontext = context;
    }

    @Override
    public int getCount() {
        if(infos != null)
            return infos.size();

        return  0;
    }

    @Override
    public Object getItem(int position) {
        if(infos != null)
            return  infos.get(position);

        return  null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
            OrderDetailInfo info = infos.get(position);
            LayoutInflater _LayoutInflater=LayoutInflater.from(mcontext);
            v=_LayoutInflater.inflate(R.layout.order_list_item, null);
            TextView name, phone, address;
            name = (TextView) v.findViewById(R.id.order_list_item_name);
            phone = (TextView) v.findViewById(R.id.order_list_item_phone);
            address = (TextView) v.findViewById(R.id.order_list_item_address);
            name.setText(info.name);
            phone.setText(info.phone);
            address.setText(info.address);

        return  v;
    }
}
